package cn.xiaopengstack.domain.trade.model.entity;

import lombok.*;

/**
 * @author jiangyangang
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TradeRefundResponseEntity {

    /**
     * 拼团队伍ID
     */
    private String teamId;

    /**
     * 退款单号
     */
    private String refundOrderId;

    /**
     * 用户ID
     */
    private String userId;

    /**
     * 行为枚举
     */
    private TradeRefundResponseStatusEnum tradeRefundResponseStatusEnum;

    @Getter
    @AllArgsConstructor
    @NoArgsConstructor
    public enum TradeRefundResponseStatusEnum {

        SUCCESS("success", "成功"),
        REPEAT("repeat", "重复"),
        MISS("miss", "不存在"),
        FAIL("fail", "失败"),

        ;

        private String code;
        private String info;
    }

    public static TradeRefundResponseEntity buildMiss(String userId){
        return TradeRefundResponseEntity
                .builder()
                .tradeRefundResponseStatusEnum(TradeRefundResponseEntity.TradeRefundResponseStatusEnum.MISS)
                .userId(userId)
                .build();
    }

    public static TradeRefundResponseEntity buildFail(String userId){
        return TradeRefundResponseEntity
                .builder()
                .tradeRefundResponseStatusEnum(TradeRefundResponseStatusEnum.FAIL)
                .userId(userId)
                .build();
    }
}
